package com.heima.hellospring.util;

import com.heima.hellospring.constant.REnum;
import com.heima.hellospring.vo.R;

public class RUtil {
    public static R success(Object object,Long count){
        R result = new R();
        result.setCode(0);
        result.setMsg("成功");
        result.setCount(count);
        result.setData(object);
        return result;
    }

    public static R success(Object object){
        return success(object,null);
    }

    public static R success( ){
        return success(null);
    }

    public static R error(Integer code, String msg){
        R result = new R();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

    public static R error(REnum rEnum){
        R result = new R();
        result.setCode(rEnum.getCode());
        result.setMsg(rEnum.getMsg());
        return result;
    }

}
